package com.wang.study.mapper;

import com.wang.study.model.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface GoodsMapper {
    @Select("select * from mall_goods where categoryid=#{cid}")
    List<Goods> findGoodsByCid(Integer cid);
    @Select("select * from mall_goods where id=#{cid}")
    Goods selectGoodById(String cid);
    @Select("select * from mall_goods")
    List<Goods> findGoodsAll();
    @Delete("delete from mall_goods where id=#{id}")
    Integer delGoodsById(Integer id);
    @Insert("insert into mall_goods (id,author,publisher,name,decription,image,salesprice,staus,uptime) values (#{id},#{author},#{publisher},#{name},#{decription},#{image},#{salesprice},#{status},#{uptime})")
    Integer addGoods(@Param("id")Integer id,@Param("author")String author, @Param("publisher")String publisher, @Param("name")String name, @Param("decription")String decription, @Param("image")String image, @Param("salesprice")String salesprice, @Param("status")String status, @Param("uptime")String uptime);
    @Update("update mall_goods set image=#{imgPath} where id = #{id}")
    Integer updateGoodById(@Param("id") Integer id, @Param("imgPath") String imagePath);
    @Select("select * from mall_goods where  name like #{name}")
    List<Goods> likeSearch(String name);
}
